package com.ncmmall.domain.business.order;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.ncmmall.domain.business.goods.sku.GoodsSku;
import com.ncmmall.domain.business.goods.unit.GoodsUnit;
import com.ncmmall.domain.business.marketing.seckill.SeckillSession;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
 * @author linxs
 * @Description: 订单详细
 * @Date: 2019-07-15 17:39
 */
@Entity
@Table(name = "mall_order_detail")
@Access(AccessType.FIELD)
public class OrderDetail {


    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    /**
     * SKU
     */
    @OneToOne
    private GoodsSku sku;

    /**
     * 单位
     */
    @OneToOne
    private GoodsUnit unit;

    /**
     * 单位数量
     */
    private int unitquantity;

    /**
     * 商品编号
     */
    private String productNo;

    /**
     * 商品缩略图
     */
    private String defaultImage;

    /**
     * 商品名称
     */
    private String goodsName;

    /**
     * 规格说明(sku组合规格名称）
     */
    private String specs;

    /**
     * 购买数量
     */
    private int quantity;

    /**
     * 按需发货数量
     */
    private int deliveryQuantity;

    /**
     * 已发货数量
     */
    private int shippedQuantity;

    /**
     * 发货类型
     * 1、全部发货
     * 2、按需发货
     */
    private int deliveryType;

    /**
     * 商品小计（单价 * 数量）
     */
    private double price;

    /**
     * 单价（sku的价格）
     */
    private double unitPrice;

    /**
     * 备注
     */
    private String note;

    @JsonBackReference
    @ManyToOne
    @JoinColumn(name = "order_id")
    @NotFound(action = NotFoundAction.IGNORE)
    private Order order;

    /**
     * 是否售后
     * 1、是
     */
    private int isAfterSale;

    /**
     * 1、已评价
     */
    private int commentStatus;

    /**
     * 按需发货数量达标状态
     * 1、已达标
     */
    private int finishNeedDeliveryStatus;

    /**
     * 活动订单类型
     * 0、普通订单
     * 1、赠品活动订单
     * 2、拼团活动订单
     * 3、特价活动订单
     * 4、秒杀活动订单
     * 5、预售活动订单
     */
    private int marketingType;

    /**
     * 关联的秒杀活动场次
     */
    @OneToOne
    private SeckillSession seckillSession;

    /**
     * 商品ID
     */
    @Transient
    private long goodsId;

    /**
     * 预售商品订金开始支付时间
     */
    @Transient
    private String presellSubscriptionPayBeginTime;

    /**
     * 预售商品订金截止支付时间
     */
    @Transient
    private String presellSubscriptionPayEndTime;

    /**
     * 预售商品尾款开始支付时间
     */
    @Transient
    private String presellRetainagePayBeginTime;

    /**
     * 预售商品尾款截止支付时间
     */
    @Transient
    private String presellRetainagePayEndTime;

    /**
     * 预售活动状态
     * 1：待审核
     * 2：审核中
     * 3：审核通过，活动未开始
     * 4：审核被拒绝
     * 5：活动开始（定金开始支付）
     * 6：定金截止支付
     * 7：尾款开始支付
     * 8：活动结束（尾款截止支付）；
     * 9：下架
     */
    @Transient
    private int presellStatus;

    /**
     * 拼团状态
     * 1：待审核
     * 2：审核中
     * 3：审核通过，活动未开始
     * 4：审核被拒绝
     * 5：活动开始
     * 6：活动结束
     * 7：下架
     */
    @Transient
    private int groupBookingStatus;

    /**
     * 特价活动状态
     * 1：待审核
     * 2：审核中
     * 3：审核通过，活动未开始
     * 4：审核被拒绝
     * 5：活动开始
     * 6：活动结束
     * 7：下架
     */
    @Transient
    private int bargainStatus;

    /**
     * 秒杀活动状态
     * 1：待审核
     * 2：审核中
     * 3：审核通过，活动未开始
     * 4：审核被拒绝
     * 5：活动开始
     * 6：活动结束
     * 7：下架
     */
    @Transient
    private int seckillStatus;

    @Transient
    private long unitId;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public GoodsSku getSku() {
        return sku;
    }

    public void setSku(GoodsSku sku) {
        this.sku = sku;
    }

    public String getProductNo() {
        return productNo;
    }

    public void setProductNo(String productNo) {
        this.productNo = productNo;
    }

    public String getDefaultImage() {
        return defaultImage;
    }

    public void setDefaultImage(String defaultImage) {
        this.defaultImage = defaultImage;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getSpecs() {
        return specs;
    }

    public void setSpecs(String specs) {
        this.specs = specs;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    public int getIsAfterSale() {
        return isAfterSale;
    }

    public void setIsAfterSale(int isAfterSale) {
        this.isAfterSale = isAfterSale;
    }

    public int getCommentStatus() {
        return commentStatus;
    }

    public void setCommentStatus(int commentStatus) {
        this.commentStatus = commentStatus;
    }

    public long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(long goodsId) {
        this.goodsId = goodsId;
    }

    public int getMarketingType() {
        return marketingType;
    }

    public void setMarketingType(int marketingType) {
        this.marketingType = marketingType;
    }

    public String getPresellSubscriptionPayBeginTime() {
        return presellSubscriptionPayBeginTime;
    }

    public void setPresellSubscriptionPayBeginTime(String presellSubscriptionPayBeginTime) {
        this.presellSubscriptionPayBeginTime = presellSubscriptionPayBeginTime;
    }

    public String getPresellSubscriptionPayEndTime() {
        return presellSubscriptionPayEndTime;
    }

    public void setPresellSubscriptionPayEndTime(String presellSubscriptionPayEndTime) {
        this.presellSubscriptionPayEndTime = presellSubscriptionPayEndTime;
    }

    public String getPresellRetainagePayBeginTime() {
        return presellRetainagePayBeginTime;
    }

    public void setPresellRetainagePayBeginTime(String presellRetainagePayBeginTime) {
        this.presellRetainagePayBeginTime = presellRetainagePayBeginTime;
    }

    public String getPresellRetainagePayEndTime() {
        return presellRetainagePayEndTime;
    }

    public void setPresellRetainagePayEndTime(String presellRetainagePayEndTime) {
        this.presellRetainagePayEndTime = presellRetainagePayEndTime;
    }

    public int getPresellStatus() {
        return presellStatus;
    }

    public void setPresellStatus(int presellStatus) {
        this.presellStatus = presellStatus;
    }

    public int getGroupBookingStatus() {
        return groupBookingStatus;
    }

    public void setGroupBookingStatus(int groupBookingStatus) {
        this.groupBookingStatus = groupBookingStatus;
    }

    public int getBargainStatus() {
        return bargainStatus;
    }

    public void setBargainStatus(int bargainStatus) {
        this.bargainStatus = bargainStatus;
    }

    public int getSeckillStatus() {
        return seckillStatus;
    }

    public void setSeckillStatus(int seckillStatus) {
        this.seckillStatus = seckillStatus;
    }

    public double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(double unitPrice) {
        this.unitPrice = unitPrice;
    }

    public SeckillSession getSeckillSession() {
        return seckillSession;
    }

    public void setSeckillSession(SeckillSession seckillSession) {
        this.seckillSession = seckillSession;
    }

    public int getDeliveryQuantity() {
        return deliveryQuantity;
    }

    public void setDeliveryQuantity(int deliveryQuantity) {
        this.deliveryQuantity = deliveryQuantity;
    }

    public int getDeliveryType() {
        return deliveryType;
    }

    public void setDeliveryType(int deliveryType) {
        this.deliveryType = deliveryType;
    }

    public int getShippedQuantity() {
        return shippedQuantity;
    }

    public void setShippedQuantity(int shippedQuantity) {
        this.shippedQuantity = shippedQuantity;
    }

    public GoodsUnit getUnit() {
        return unit;
    }

    public void setUnit(GoodsUnit unit) {
        this.unit = unit;
    }

    public int getUnitquantity() {
        return unitquantity;
    }

    public void setUnitquantity(int unitquantity) {
        this.unitquantity = unitquantity;
    }

    public long getUnitId() {
        return unitId;
    }

    public void setUnitId(long unitId) {
        this.unitId = unitId;
    }

    public int getFinishNeedDeliveryStatus() {
        return finishNeedDeliveryStatus;
    }

    public void setFinishNeedDeliveryStatus(int finishNeedDeliveryStatus) {
        this.finishNeedDeliveryStatus = finishNeedDeliveryStatus;
    }
}
